package com.xinghen.ace.auth.controller;

import com.xinghen.ace.auth.biz.ClientBiz;
import com.xinghen.ace.auth.model.entity.Client;
import com.xinghen.ace.common.response.RestResult;
import com.xinghen.ace.common.rest.BaseController;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author xinghen
 * @ClassName: ServiceController
 * @Package: com.xinghen.ace.auth.controller
 * @Description service controller
 * @create 2018/5/4 16:09
 */
@RestController
@RequestMapping("service")
public class ServiceController extends BaseController<ClientBiz, Client> {

    @RequestMapping(value = "/{id}/client", method = RequestMethod.PUT)
    @ResponseBody
    public RestResult modifyUsers(@PathVariable int id, String clients) {
        biz.modifyClientServices(id, clients);
        return RestResult.ok();
    }

    @RequestMapping(value = "/{id}/client", method = RequestMethod.GET)
    @ResponseBody
    public RestResult<List<Client>> getUsers(@PathVariable int id) {
        return RestResult.ok(biz.getClientServices(id));
    }
}
